package com.open.basic.json;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.UUID;


/**
 * @author: zm
 * @Date: 2025/7/5 21:59
 * @Version: V1.0
 * @description: |
 */

public class JsonNodeDemo {

    public static void main(String[] args) {
        ObjectNode jsonNode = JsonHelper.createJsonNode();
        ObjectNode jsonNode2 = JsonHelper.createJsonNode();
        jsonNode.put("name", "xx");
        jsonNode.put("age", 18);
        jsonNode.put("sex", true);
        jsonNode2.put("name", "yy");
        jsonNode2.put("age", 19);
        jsonNode2.put("sex", false);
        jsonNode.set("child", jsonNode2);
        JsonNode name = jsonNode.get("name");
        System.out.println(name.asInt());
        // 输出json
        System.out.println(jsonNode.toString());
        System.out.println(jsonNode.toPrettyString());
        System.out.println(JsonHelper.createJsonNode());

        String replace = UUID.randomUUID().toString().replace("-", "");
        System.out.println(replace.length() + ":" +  replace);
    }

}
